const { contextBridge, ipcRenderer } = require('electron');


fetch('http://localhost:8080/snow-stomp/info', {
    credentials: 'include',
    headers: { 'Origin': 'http://localhost:5173' }
}).then(r => r.json()).then(console.log);

contextBridge.exposeInMainWorld('electronAPI', {
    minimizeWindow: () => {
        ipcRenderer.send('minimize-window');
    },
    maximizeWindow: () => {
        ipcRenderer.send('maximize-window');
    },
    editWindow: () => {
        ipcRenderer.send('edit-window');
    },
    getFloatingBallState: () => {
        ipcRenderer.send('get-floating-ball-state')
    },
    sendDragEvent: (x, y) => {
        ipcRenderer.send('drag-floating-window', { x, y })
    },
    toggleFloatingBall: (shouldShow) => {
        ipcRenderer.send('toggle-floating-ball', shouldShow)
    }
})

window.addEventListener('DOMContentLoaded', () => {
    const replaceText = (selector, text) => {
        const element = document.getElementById(selector)
        if (element) element.innerText = text
    }
测试
    for (const dependency of ['chrome', 'node', 'electron']) {
        replaceText(`${dependency}-version`, process.versions[dependency])
    }
})


